#pragma once

#include <QString>
#include <unordered_map>
#include <mutex>
#include <QStringList>
#include <QVariantMap>

class Array
{
public:
    const QStringList arr;
    const QString tabStr;
};
class ArrayPool
{
private:
    ArrayPool();
public:
    static uint32_t add(const QStringList &obj, const QString &tabStr);
    static Array at(uint32_t id);
    static void free(uint32_t id);
private:
    uint32_t _add(const QStringList &obj, const QString &tabStr);
    Array _at(uint32_t id);
    void _free(uint32_t id);
private:
    std::mutex locker;
    uint32_t lastIndex = 1;
    std::unordered_map<uint32_t, Array> arrays = std::unordered_map<uint32_t, Array>(1024);
private:
    static ArrayPool *instance();
    static ArrayPool *_instance;
};

